<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">
    <title></title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <link href="/public/bootstrap3/css/style.css" rel="stylesheet">
    <link href="/public/bootstrap3/css/style-responsive.css" rel="stylesheet">
    <link href="/public/css/util/util-form.css" rel="stylesheet">
    <style type="text/css">

    </style>
</head>
<body class="sticky-header">
<div class="row">
    <div class="col-xs-12">
        <section class="panel">
            <div class="panel-heading">
                <div>表单模版-标题</div>
            </div>
            <div class="panel-body ops-global-panel">
                <form class="form-horizontal tasi-form ops-global-form" id="${entityFirstLowerName}From" method="post">
                    <input type="hidden" id="id" name="id" value="${r'${'}${entityFirstLowerName}.id${r'}'}">
                    <#list columnMap as column><#if column.attrEnName != "createtime" && column.attrEnName !="createby">
                    <div class="form-group col-xs-6">
                        <label class="col-xs-4 control-label">${column.attrChName}</label>
                        <div class="col-xs-8">
                            <input type="text" class="form-control" id="${column.attrEnName}" name="${column.attrEnName}" value="<c:if test="${r'${not empty '}${entityFirstLowerName}.${column.attrEnName} && ${entityFirstLowerName}.${column.attrEnName}!=''${r'}'}">${r'${'}${entityFirstLowerName}.${column.attrEnName}${r'}'}</c:if>">
                        </div>
                    </div></#if>
                    </#list>
                    <!-- 线条-误删 -->
                    <div class="form-group col-xs-12">
                    </div>
                </form>
            </div>
            <div class="col-xs-12 ops-global-submit">
                <button class="btn btn-success col-xs-offset-3 col-xs-2" type="button" id = "${entityFirstLowerName}Save">保存</button>
                <button class="btn btn-default col-xs-offset-2 col-xs-2" type="button" id = "${entityFirstLowerName}Cancle">取消</button>
            </div>
        </section>
    </div>
</div>
</body>
<script src="/public/js/jquery-3.2.1.min.js"></script>
<script>
    $(function(){
        var frameIndex = parent.layer.getFrameIndex(window.name);
        $('#${entityFirstLowerName}Save').click(function(){
            var formAction;
            var type = $("#id").val();
            if(type == ''){
                formAction = '${entityFirstLowerName}/save${entityName}';
            }else{
                formAction = '${entityFirstLowerName}/update${entityName}';
            }
            $.ajax({
                type:"post",
                url:formAction,
                dataType:"json",
                data : $('#${entityFirstLowerName}From').serialize(),
                success:function(data){
                    if(data.resCode == '200'){
                        parent.layer.msg(data.resMessage,{time:1200});
                        parent.$("#${entityFirstLowerName}Table").bootstrapTable('refresh',{silent: true});
                        parent.layer.close(frameIndex);
                        return true;
                    }else {
                        parent.layer.close(frameIndex);
                        parent.layer.msg(data.resMessage);
                        return false;
                    }
                },
                error:function(data){
                    parent.layer.msg("未知错误");
                }
            })
        })
        $('#${entityFirstLowerName}Cancle').click(function(){
            parent.layer.msg('取消操作', {
                time: 1200 //20s后自动关闭
            });
            parent.layer.close(frameIndex);
        })
    })
</script>
</html>